from AUTOBing.page.page import Page
import pytest,time
from selenium import webdriver

@pytest.fixture(scope='class')
def driver():
    #加载驱动
    driver=webdriver.Firefox()
    driver.maximize_window()
    driver.implicitly_wait(5)
    yield driver
    driver.quit()


def test_bing(driver):
    #PO模型
    po=Page(driver)
    po.open_url('https://www.bing.com/')
    assert '大雪暴雪即将上线！' in po.dy2()
    print(po.dy2())
    time.sleep(3)
    print('Microsoft Bing')
    po.search()
    po.fangda()
    time.sleep(4)
    po.dy1()
    assert '自动化软件测试' in po.dy1()
    print(f'结果是：',po.dy1())
    time.sleep(3)

    po.one()
    assert '软件测试' in po.one()
    print('第一页所有标题文本是:',po.one())
    time.sleep(3)

    #下一页
    #po.nexts()
    po.two()
    assert '软件测试' in po.two()
    print('第二页所有标题文本是:', po.two())
    time.sleep(3)